<?php

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Http\Request;

class UserPermissionController extends Controller
{
    /**
     * 获取用户权限
     *
     * @param int $userId
     * @return \Illuminate\Http\JsonResponse
     */
    public function show($userId)
    {
        $user = User::findOrFail($userId);
        
        $permissionService = app(\App\Services\PermissionService::class);
        
        $data = [
            'permissions' => $permissionService->getUserPermissions($user),
            'menu_permissions' => $permissionService->getUserMenuPermissions($user),
            'button_permissions' => $permissionService->getUserButtonPermissions($user),
        ];

        return $this->success($data, '获取成功');
    }
}

